package com.lqq.school.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpSession;

@Controller
public class LogoutController {
    @RequestMapping("/logout")
    public String logout(Model model,
                         RedirectAttributes redirectAttributes ){
            //使用权限管理工具进行用户的退出，跳出登录，给出提示信息
            Subject subject = SecurityUtils.getSubject();
            if (subject.isAuthenticated()) {
                subject.logout();
            }
        model.addAttribute("msg", "您已经成功退出！！！");
        return "index";
    }
}
